/*
import axios from "axios"
import { config } from "@/config/config"
//import Vue from "vue"


axios.defaults.baseURL = config.baseUrl
axios.defaults.timeout = config.timeout

axios.interceptors.response.use(value => {
  const data = value.data

  // 这里是数据层报错
  if (data.code === 999) {
    //Vue.prototype.$msg.warning(data.msg)
  }
  return data
}, err => {  // 这里是http层报错
  return { code: 999, msg: err.toString() }
})

axios.interceptors.request.use(value => {
  return value
})


const get = function (url, params) {
  if (params instanceof Number) {
    return axios.get(url + `/${params}`)
  } else {
    return axios.get(url, { params })
  }
}

const post = function (url, data) {
  return axios.post(url, data)
}

const put = function (url, data) {
  return axios.put(url, data)
}

const del = function (url, id) {
  return axios.delete(url+ `/${id}`)
}

export const requests = {
  get, post, put, del
}


/!**
 * Rest请求基础类
 * @param url 资源路径
 *!/
export class RestRequest {
  constructor(url) {
    this.url = url
    return this
  }

  getOne (id) {
    return requests.get(this.url + `/${id}`)
  }

  getAll(data) {
    return requests.get(this.url, data)
  }

  getPage (current = 1, size = 20) {
    return requests.get(this.url, { current, size })
  }

  add (data) {
    return requests.post(this.url, data)
  }

  update (data) {
    return requests.put(this.url, data)
  }

  /!*updateBatch(list) {
    const url = this.url + "s"
    return requests.put(url, list)
  }*!/

  delete (id) {
    return requests.del(this.url, id)
  }
}


*/
